package com.atguigu.flink.day05;

import com.atguigu.flink.bean.WaterSensor;
import com.atguigu.flink.func.WaterSensorMapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author Felix
 * @date 2024/8/14
 * 该案例演示窗口API的概述
 */
public class Flink04_Window_API {
    public static void main(String[] args) {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        SingleOutputStreamOperator<WaterSensor> wsDS = env
                .socketTextStream("hadoop102", 8888)
                .map(new WaterSensorMapFunction());

        //窗口API
        //如果没有做keyBy，
        //wsDS.windowAll();
        //wsDS.countWindowAll()
        //keyBy
        wsDS
                .keyBy(WaterSensor::getId);
                //.window()
                //.trigger()
                //.evictor()
                //.reduce()
                //.aggregate()
                //.apply()
                //.process()


    }
}
